package com.example.mapper;


import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;
import java.util.Map;

/**
* @description
* @author        庞留杰
* @date          2020/8/24 13:42
* @version       V1.0
**/
public interface MyMapper extends BaseMapper<Map<String,Object>> {

    @Select("SELECT  " +
            " su.id AS user_id, " +
            " su.user_code, " +
            " su.user_name, " +
            " su.real_name, " +
            " su.password, " +
            " su.email, " +
            " (SELECT GROUP_CONCAT(sur.role_id)FROM sys_user_role sur WHERE sur.user_id=su.id) AS role_ids " +
            "FROM sys_user su " +
            "WHERE su.is_delete=0")
    List<Map<String,Object>> findUsersAndRoleIds();

    @Select("select sr.* from sys_role sr WHERE sr.is_delete=0")
    List<Map<String,Object>> findRoles();

}
